from django.db import models
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.db.models.query import QuerySet
from tinymce import models as tinymce_models
def today():
	now = datetime.now()
	start = datetime.min.replace(year=now.year, month=now.month, day=now.day)
	end = (start + timedelta(days=1)) - timedelta.resolution
	return (start, end)

class Page(models.Model):
	name = models.CharField(max_length=100, help_text='The Title of the Page')
	content = models.TextField()
	creation_date = models.DateTimeField(default=datetime.now())
	creator = models.ForeignKey(User, related_name='entry_creator_set')
	page_uri = models.CharField(max_length=20, help_text='The url extension Ex: http://c-pj.net/page/{here}')
	def __unicode__(self):
		return self.page_uri
	def get_absolute_url(self):
		return "/page/%s/" % self.page_uri	
